/**
 * 获取设备信息
 * @returns {Promise<Object>} 设备信息对象
 */
export const getDeviceInfo = () => {
  return new Promise((resolve) => {
    // #ifdef APP-PLUS
    const appDeviceInfo = {
      deviceId: plus.device.uuid,
      platform: plus.os.name,
      version: plus.os.version,
      language: plus.os.language,
      vendor: plus.device.vendor,
      model: plus.device.model,
      screenWidth: plus.screen.resolutionWidth,
      screenHeight: plus.screen.resolutionHeight,
      pixelRatio: plus.screen.scale
    };
    resolve(appDeviceInfo);
    // #endif
    
    // #ifdef H5
    const webDeviceInfo = {
      deviceId: 'h5_' + Math.random().toString(36).substr(2),
      platform: 'web',
      version: navigator.userAgent,
      language: navigator.language,
      vendor: navigator.vendor,
      model: navigator.platform,
      screenWidth: window.screen.width,
      screenHeight: window.screen.height,
      pixelRatio: window.devicePixelRatio
    };
    resolve(webDeviceInfo);
    // #endif
  });
}; 